package tool;

import java.awt.Color;

import javax.swing.JButton;

import java.awt.Font;
import java.awt.Toolkit;
import java.awt.Graphics;
import java.awt.Image;

public class MyButton extends JButton {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	String filename;

	public MyButton(String filename) {
		super();
		this.filename = filename;
		this.setFont(new Font("微软雅黑", 1, 13));
		this.setForeground(Color.white);
	}

	public void paint(Graphics g) {
		this.setBackground(new Color(0, 0, 0, 0));
		Image background = Toolkit.getDefaultToolkit().getImage(filename);
		g.drawImage(background, 0, 0, null);
		super.paint(g);
	}

}
